﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using System.IO;
using Icinetic.FeedCategorySample.Services;
using Icinetic.FeedCategorySample.ViewModel;
using System.Threading.Tasks;
using Windows.UI;
using Icinetic.FeedCategorySample.Services.Repositories;

namespace FeedCategorySample.Test
{
    [TestClass]
    public class MainPageViewModelTest
    {
        private string dbPath = BaseRepository.DbPath;

        [TestInitialize]
        public void TestInitialize()
        {
            BaseRepository.DbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "FeedCategorySampleTestDB.db");
            BaseRepository.Initialize();
        }

        [TestCleanup]
        public void TestCleanup()
        {
            BaseRepository.DbPath = dbPath;
        }

        [TestMethod]
        public async Task LoadFeedListTest()
        {
            MainPageViewModel model = new MainPageViewModel();
            await model.LoadFeedList();
            
            Assert.IsTrue(model.CategoryList.Count > 0);
        }
    }
}
